// routes/tableRoutes.js
const express = require('express');
const router = express.Router();
const tableController = require('../controllers/tableController');
const authenticateToken = require('../middleware/auth');

// 公共路由
router.get('/', tableController.getAllTables);
router.get('/:id', tableController.getTableById);
router.post('/scan', tableController.scanTableQrCode);


// 管理员路由（需要认证）
router.post('/', authenticateToken, tableController.createTable);
router.put('/:id', authenticateToken, tableController.updateTable);
router.delete('/:id', authenticateToken, tableController.deleteTable);
router.post('/:id/qrcode', authenticateToken, tableController.generateTableQrCode);
router.post('/:id/status', authenticateToken, tableController.updateTableStatus);

module.exports = router;